home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Framework / Includes / UFileStream.h < prev    next >
Encoding:
Text File  |  1996-04-03  |  2.6 KB  |  113 lines  |  [TEXT/MPS ]

  1. // UFileStream.h
  2. // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
  3. // Originally written by Larry S. Rosenstein. Used by permission
  4.  
  5.  
  6. #ifndef __UFILESTREAM__
  7. #define __UFILESTREAM__
  8.  
  9. // MacApp
  10.  
  11. #ifndef __GEOMETRY__
  12. #include "Geometry.h"
  13. #endif
  14.  
  15. #ifndef __TOOLBOX__
  16. #include "Toolbox.h"
  17. #endif
  18.  
  19. #ifndef __UGEOMETRY__
  20. #include "UGeometry.h"
  21. #endif
  22.  
  23. #ifndef __UOBJECT__
  24. #include "UObject.h"
  25. #endif
  26.  
  27. #ifndef __USTREAM__
  28. #include "UStream.h"
  29. #endif
  30.  
  31. // Toolbox
  32.  
  33.  
  34. //----------------------------------------------------------------------------------------
  35. // Forward class declarations. 
  36. //----------------------------------------------------------------------------------------
  37.  
  38. class TFile;
  39. class TList;
  40.  
  41. //----------------------------------------------------------------------------------------
  42. // TFileStream: This implements a stream on a file. The client is responsible for opening
  43. // and closing the file. 
  44. //----------------------------------------------------------------------------------------
  45.  
  46. class TFileStream : public TStream
  47. {
  48.     MA_DECLARE_CLASS;
  49.     
  50. public:
  51.     TFile* fFile; 
  52.  
  53.     //------------------------------------------------------------------------------------
  54.     // Creation/Destruction 
  55.     //------------------------------------------------------------------------------------
  56.  
  57.     TFileStream();
  58.         // Constructor
  59.     virtual ~TFileStream();
  60.         // Destructor
  61.         
  62.     void IFileStream(TFile* itsFile);
  63.  
  64.  
  65.     //------------------------------------------------------------------------------------
  66.     // SubClass Implementations 
  67.     //------------------------------------------------------------------------------------
  68.  
  69.     virtual long GetPosition();
  70.  
  71.     virtual void SetPosition(long newPosition);
  72.  
  73.     virtual long GetSize();
  74.  
  75.     virtual void SetSize(long newSize);
  76.  
  77.     virtual void ReadBytes(void* p, long count); 
  78.  
  79.     virtual void WriteBytes(const void* p, long count); 
  80.  
  81. };
  82.  
  83.  
  84. //----------------------------------------------------------------------------------------
  85. // TFileResourceStream: This implements a stream that reads and writes to partial resources.
  86. // Since the partial resources traps are only available in System 7, this stream class can
  87. // only be used under System 7. 
  88. //----------------------------------------------------------------------------------------
  89.  
  90. class TFileResourceStream : public TResourceStream
  91. {
  92.     MA_DECLARE_CLASS;
  93.  
  94. public:
  95.     TFile*        fFile;
  96.     
  97.     TFileResourceStream();
  98.     virtual ~TFileResourceStream();
  99.         // Destructor
  100.     
  101.     virtual void IFileResourceStream( TFile* theFile, 
  102.                                 ResType theType, ResNumber theID);
  103.     
  104.     virtual void WriteBytes(const void* p, long count);
  105.  
  106.     virtual void ReadBytes(void* p, long count);
  107.  
  108.     virtual void SetSize(long newSize);
  109. };
  110.  
  111.  
  112. #endif // __UFILESTREAM__
  113.